package qinggui.mlz.app.controller.index;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import qinggui.mlz.module.index.IndexService;
import qinggui.mlz.module.utils.Response;

import java.util.List;
import java.util.Map;

@RestController
public class IndexController {
    @Autowired
    private IndexService indexService;

    /**
     * 获取首页数据
     * @return Response
     */
    @RequestMapping("/index")
    public Response index()  {
        Map<String, Object> indexData;
        try {
            indexData = indexService.getIndexData();
        } catch (InterruptedException e) {
            return new Response<>(4004, "获取首页数据失败");
        }
        return new Response<>(1001, indexData);
    }
}
